<?php

class ItemController extends Zend_Controller_Action
{

    public function init()
    {
        /* Initialize action controller here */
    }

    public function indexAction()
    {
        // action body
    }

 public function canceledAction()
    {
    	
    }
    public function icancelAction()
    {
        // action body
    	if($this->getRequest()->isPost())
    	{
    		$del = $this->getRequest()->getPost('del');
    		if($del=='Yes')
    		{
    			$item_no = $this->getRequest()->getPost('item_no');
    			$item_status = $this->getRequest()->getPost('item_status');
    			//$item_total_price = $this->getRequest()->getPost('item_total_price');
    			$order_no = $this->getRequest()->getPost('order_no');
    			//$order_price = $this->getRequest()->getPost('order_price');
    			$result_price = $this->getRequest()->getPost('result_price');
    			
    			$items = new Application_Model_DbTable_Items();
    			$orders = new Application_Model_DbTable_Orders();
    			$products = new Application_Model_DbTable_Products();
    			if($item_status == "C")
    			{
    				$this->_helper->redirector('canceled', 'item');
    			}
    			else{
    				
    				$items->cancelItem($item_no);
    				$orders->itemdelOrder($order_no, $result_price);
    			}
    			
    			$this->_helper->redirector('enquiry', 'order');
    	
    	
    		}
    		$this->_helper->redirector('enquiry', 'order');
    	}
    	
    	else
    	{
    		$item_no = $this->_getParam('item_no', 0);
    		$item = new Application_Model_DbTable_Items();
    		$this->view->items = $item->getItem($item_no);
    		
    		$order_no = $this->_getParam('order_no', 0);
    		$order = new Application_Model_DbTable_Orders();
    		$this->view->orders=$order->getOrder($order_no);
    	}
    }
    

}





